#ifndef TABLEMODEL_H
#define TABLEMODEL_H

#include <QtGui>
#include "Track.h"
#include "MusicList.h"

class TableModel : public QAbstractTableModel
{
	Q_OBJECT
	public:
	TableModel(QObject *parent=0);
	TableModel(MusicList* list, QObject *parent=0);
	int rowCount(const QModelIndex &parent=QModelIndex()) const;
	int columnCount(const QModelIndex &parent=QModelIndex()) const;
	QVariant data(const QModelIndex &index, int role) const;
	QVariant headerData(int section, Qt::Orientation orientation, int role) const;
	Qt::ItemFlags flags(const QModelIndex &index) const;
	bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole);
	bool insertRows(int position, int rows, const QModelIndex &index=QModelIndex());
	bool removeRows(int position, int rows, const QModelIndex &index=QModelIndex());
	MusicList* getList();
	void setDataSelected(const QModelIndex &index);
	QModelIndex giveIndex(int row, int column);
	  
	private:
	MusicList* list;
	
	public slots:
	void onListDataChanged(int row);
	void onListDataAdded();
};

#endif

